import request from "@/utils/request";

// 用户贷款初审数据列表
export function loanFirstAuditList(stas, form = "") {
  const data = {
    status: stas, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: "", //(合同号)
    user_name: form.name, //(用户姓名)
    user_phone: form.phone, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };
  return request({
    url: "/loan/manage/loanFirstAuditList",
    method: "post",
    data: data,
  });
}

// 用户贷款初审审核详情
export function loanFirstAudit(id) {
  return request({
    url: `/loan/manage/loanFirstAuditInfo/${id}`,
    method: "get",
  });
}
// 用户贷款初审操作
export function handleLoanFirstAudit(data) {
  return request({
    url: `/loan/manage/loanFirstAudit`,
    method: "post",
    data: data,
  });
}

// 用户贷款复审数据列表
export function loanReexamineList(stas, form = "") {
  const data = {
    status: stas, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: "", //(合同号)
    user_name: form.name, //(用户姓名)
    user_phone: form.phone, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };
  return request({
    url: "/loan/manage/loanReexamineList",
    method: "post",
    data: data,
  });
}

// 用户贷款复审审核详情
export function loanReexamineInfo(id) {
  return request({
    url: `/loan/manage/loanReexamineInfo/${id}`,
    method: "get",
  });
}
// 用户贷款复审操作
export function loanReexamine(data) {
  return request({
    url: `/loan/manage/loanReexamine`,
    method: "post",
    data: data,
  });
}

// 贷款审核-客户资料数据查询
export function queryListInfo(userId, loanId) {
  return request({
    url: `/loan/manage/loanInfoParameter/${userId}/${loanId}`,
    method: "post",
  });
}

///获取身份证照片
export function getPhoto(userId) {
  return request({
    url: `userCertificates/queryUserCertificates/${userId}`,
    method: "get",
  });
}

///查询用户信息
export function getInfo(userId) {
  return request({
    url: `userInfo/query/${userId}`,
    method: "get",
  });
}

///文件上传临时访问
export function getImage(data) {
  return request({
    url: `/file/fileHttpUrl`,
    method: "post",
    data: data,
  });
}

// 用户贷款终审数据列表
export function loanFinalAuditList(stas, form = "") {
  const data = {
    status: stas, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: "", //(合同号)
    user_name: form.name, //(用户姓名)
    user_phone: form.phone, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };
  return request({
    url: "/loan/manage/loanFinalAuditList",
    method: "post",
    data: data,
  });
}

// 用户贷款终审操作
export function loanFinalAudit(data) {
  return request({
    url: `/loan/manage/loanFinalAudit`,
    method: "post",
    data: data,
  });
}

// 用户贷款终审审核详情
export function getLoanFinalAudit(id) {
  return request({
    url: `/loan/manage/loanFinalAuditInfo/${id}`,
    method: "get",
  });
}

// 用户贷款合同管理数据列表
export function loanContractList(form = "") {
  const data = {
    status: form.status, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: form.code, //(合同号)
    user_name: form.name, //(用户姓名)
    user_phone: form.name, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };
  return request({
    url: "/loan/manage/loanContractList",
    method: "post",
    data: data,
  });
}
// 用户贷款放款审批数据列表
export function loanApprovaltList(form = "") {
  const data = {
    status: form.status, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: form.code, //(合同号)
    user_name: form.phone, //(用户姓名)
    user_phone: form.phone, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };
  return request({
    url: "/loan/manage/loanApprovalList",
    method: "post",
    data: data,
  });
}
// 用户贷款放款处理数据列表
export function loanDisbursementList(form = "") {
  const data = {
    status: form.status, //(状态（0-全部；1-审核中(待放款/还款录入)；2-已通过(已放款/还款确认)；3-已终止；）)
    id: form.id, //(借款编号)
    contract_code: form.code, //(合同号)
    user_name: form.phone, //(用户姓名)
    user_phone: form.phone, //(用户手机号)
    loan_type: form.type, //(贷款类型)
    start_time: form.startTime, //(开始时间)
    end_time: form.endTime, //(结束时间)
    page_size: form.page_count, //(分页页数)
    page_count: form.page_size, //(分页个数)
  };

  return request({
    url: "/loan/manage/loanDisbursementList",
    method: "post",
    data: data,
  });
}

// 用户贷款放款登记
export function loanDisbursement(data) {
  return request({
    url: `/loan/manage/loanDisbursement`,
    method: "post",
    data: data,
  });
}

// 放款凭证上传
export function loanDisbursementVoucher(data) {
  return request({
    url: `/loan/manage/loanDisbursementVoucher`,
    method: "post",
    data: data,
  });
}

// 用户贷款合同上传提交
export function loanContractUpload(data) {
  return request({
    url: `/loan/manage/loanContractUpload`,
    method: "post",
    data: data,
  });
}

// 用户贷款提交放款审批
export function loanApprovalSubmit(id) {
  return request({
    url: `/loan/manage/loanApprovalSubmit/${id}`,
    method: "post",
  });
}

// 用户贷款放款审批
export function loanApproval(id, channel) {
  return request({
    url: `/loan/manage/loanApproval/${id}/${channel}`,
    method: "post",
  });
}
//贷中管理- 合同提交
export function loanContractSumbit(data) {
  return request({
    url: "/loan/manage/loanContract",
    method: "post",
    data: data,
  });
}
